package com.cls.business.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cls.common.annotation.DecryptField;
import com.cls.common.annotation.EncryptDecryptEntity;
import com.cls.common.annotation.EncryptField;
import com.cls.common.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
/**
 * 委托课题审核成员变动记录信息表 Entity
 *
 * @author slx
 * @date 2020-12-02 14:27:30
 */
@Data
@TableName("biz_member_info_record")
@EncryptDecryptEntity
public class MemberInfoRecord extends BaseEntity implements Serializable {



    /**
     * 主键ID
     */
    @TableId(value = "member_record_id", type = IdType.AUTO)
    private Long memberRecordId;



    /**
     * 原信息id
     */
    @TableField("member_id")
    private Long memberId;



    /**
     * 操作类型（增.删.改）
     */
    @TableField("operation_code")
    private String operationCode;


    /**
     * 申请课题ID
     */
    @TableField("declare_id")
    private Long declareId;



    /**
     * 1组成员2主持人3牵头人
     */
    @TableField("member_type")
    private Integer memberType;


    /**
     * 姓名
     */
    @TableField("name")
    private String name;


    /**
     * 身份证号
     */
    @TableField("identity")
    @DecryptField
    @EncryptField
    private String identity;
    /**
     * 证件类型号
     */
    @TableField("identity_type_code")
    private String identityTypeCode;


    /**
     * 性别
     */
    @TableField("sex_type_code")
    private String sexTypeCode;


    /**
     * 出生年月
     */
    @TableField("birthday")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date birthday;


    /**
     * 职务
     */
    @TableField("position_type_code")
    private String positionTypeCode;


    /**
     * 职称级别
     */
    @TableField("title_type_code")
    private String titleTypeCode;
    /**
     * 职称手填
     */
    @TableField("profession_code")
    private String professionCode;


    /**
     * 最终学位
     */
    @TableField("degree_type_code")
    private String degreeTypeCode;


    /**
     * 研究领域
     */
    @TableField("field")
    private String field;


    /**
     * 工作单位
     */
    @TableField("company_address")
    private String companyAddress;


    /**
     * 联系电话
     */
    @TableField("mobile")
    @DecryptField
    @EncryptField
    private String mobile;


    /**
     * 电子邮箱
     */
    @TableField("email")
    @DecryptField
    @EncryptField
    private String email;
    /**
     * 名族
     */
    @TableField("nation_type_code")
    private String nationTypeCode;
    /**
     * 政治面貌
     */
    @TableField("political_type_code")
    private String politicalTypeCode;
    /**
     * 手机
     */
    @TableField("telephone")
    private String telephone;
    /**
     * 通讯地址
     */
    @TableField("address")
    private String address;
    /**
     * 邮政
     */
    @TableField("post_code")
    private String postCode;


    public MemberInfo convertToMemberInfo(){
        MemberInfo memberInfo = new MemberInfo();
        memberInfo.setMemberId(memberId);
        memberInfo.setDeclareId(declareId);
        memberInfo.setName(name);
        memberInfo.setMemberType(memberType);
        memberInfo.setIdentity(identity);
        memberInfo.setIdentityTypeCode(identityTypeCode);
        memberInfo.setSexTypeCode(sexTypeCode);
        memberInfo.setBirthday(birthday);
        memberInfo.setPositionTypeCode(positionTypeCode);
        memberInfo.setTitleTypeCode(titleTypeCode);
        memberInfo.setDegreeTypeCode(degreeTypeCode);
        memberInfo.setField(field);
        memberInfo.setCompanyAddress(companyAddress);
        memberInfo.setMobile(mobile);
        memberInfo.setEmail(email);
        memberInfo.setNationTypeCode(nationTypeCode);
        memberInfo.setPoliticalTypeCode(politicalTypeCode);
        memberInfo.setTelephone(telephone);
        memberInfo.setAddress(address);
        memberInfo.setPostCode(postCode);
        memberInfo.setProfessionCode(professionCode);

        return memberInfo;
    }


}
